﻿using System;
using System.Collections.Generic;
using UnityEngine;

public static class Constant
{
    // 精灵    
    public static readonly Dictionary<string,Sprite> Sprites=new();
    static Constant()
    {
        Resources.LoadAll<Sprite>("Sprites").Foreach((Sprite sprite) =>
        {
            string key = sprite.name;
            if (!Sprites.ContainsKey(key))
            {
                Sprites.Add(key, sprite);
            }
        });
    }

    public static class Layers
    {
        // 跳台
        public static LayerMask GroundLayer = 1 << LayerMask.NameToLayer("跳台");
        // 水面
        public static LayerMask WaterLayer = 1 << LayerMask.NameToLayer("水面");
        // 跳台+水面
        public static LayerMask GroundAndWaterLayer = (1 << LayerMask.NameToLayer("跳台"))|(1 << LayerMask.NameToLayer("水面"));
    }


    // 预制件加载对象
    public class MetaPrefab{
        public string path;
        public GameObject Load(){
            return Resources.Load<GameObject>(path);
        }
    }

    // 预制件
    public static class Prefabs
    {
        // 普通子弹
        public static MetaPrefab BulletC=new(){path="Prefabs/子弹-C"};
        public static MetaPrefab BulletBoom1=new(){path="Prefabs/子弹-爆炸1"};
        public static MetaPrefab EmenyBullet1=new(){path="Prefabs/敌-子弹1"};
        public static MetaPrefab EmenyBoom1=new(){path="Prefabs/敌-爆炸1"};
    }
}

